package com.xywy.bloodandroid.act;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.xywy.bloodandroid.R;
import com.xywy.bloodandroid.base.BaseActivity;

/**
 * *****************************************
 * 
 * @Title: SetDocotrHonorAct.java
 * @Package com.xywy.bloodandroid.act
 * @Description: TODO(设置职称)
 * @author smz
 * @date 2014-12-26 上午9:33:10
 * @version V1.0
 ******************************************* 
 */
public class SetDocotrHonorAct extends BaseActivity {

	private TextView textview11;
	private TextView textview12;
	private TextView textview13;

	private TextView textview21;
	private TextView textview22;

	private String doctor_level_name;
	private Button confirm_button;

	@Override
	protected void initView(Bundle savedInstanceState) {
		setContentView(R.layout.act_set_doctor_honor);

		textview11 = (TextView) findViewById(R.id.textview11);
		textview12 = (TextView) findViewById(R.id.textview12);
		textview13 = (TextView) findViewById(R.id.textview13);

		textview21 = (TextView) findViewById(R.id.textview21);
		textview22 = (TextView) findViewById(R.id.textview22);
		confirm_button = (Button) findViewById(R.id.confirm_button);
	}

	@Override
	protected void initListener() {
		confirm_button.setOnClickListener(this);
		
		textview11.setOnClickListener(this);
		textview12.setOnClickListener(this);
		textview13.setOnClickListener(this);
		textview21.setOnClickListener(this);
		textview22.setOnClickListener(this);
	}

	@Override
	protected void initData() {

	}

	@Override
	public void onClick(View v) {
		super.onClick(v);
		switch (v.getId()) {
		case R.id.textview11:
			doctor_level_name = "不限";

			textview11.setBackgroundResource(R.color.hosptial_name);

			textview12.setBackgroundResource(R.drawable.doctor_level_bg);
			textview13.setBackgroundResource(R.drawable.doctor_level_bg);
			textview21.setBackgroundResource(R.drawable.doctor_level_bg);
			textview22.setBackgroundResource(R.drawable.doctor_level_bg);
			break;
		case R.id.textview12:
			doctor_level_name = "主任医师";

			textview11.setBackgroundResource(R.drawable.doctor_level_bg);
			textview12.setBackgroundResource(R.color.hosptial_name);
			textview13.setBackgroundResource(R.drawable.doctor_level_bg);
			textview21.setBackgroundResource(R.drawable.doctor_level_bg);
			textview22.setBackgroundResource(R.drawable.doctor_level_bg);
			break;
		case R.id.textview13:

			doctor_level_name = "副主任医师";
			textview11.setBackgroundResource(R.drawable.doctor_level_bg);
			textview12.setBackgroundResource(R.drawable.doctor_level_bg);
			textview13.setBackgroundResource(R.color.hosptial_name);
			textview21.setBackgroundResource(R.drawable.doctor_level_bg);
			textview22.setBackgroundResource(R.drawable.doctor_level_bg);
			break;

		case R.id.textview21:
			doctor_level_name = "主治医师";
			textview11.setBackgroundResource(R.drawable.doctor_level_bg);
			textview12.setBackgroundResource(R.drawable.doctor_level_bg);
			textview13.setBackgroundResource(R.drawable.doctor_level_bg);
			textview21.setBackgroundResource(R.color.hosptial_name);
			textview22.setBackgroundResource(R.drawable.doctor_level_bg);
			break;
		case R.id.textview22:
			doctor_level_name = "医师";
			textview11.setBackgroundResource(R.drawable.doctor_level_bg);
			textview12.setBackgroundResource(R.drawable.doctor_level_bg);
			textview13.setBackgroundResource(R.drawable.doctor_level_bg);
			textview21.setBackgroundResource(R.drawable.doctor_level_bg);
			textview22.setBackgroundResource(R.color.hosptial_name);
			break;

		case R.id.confirm_button:

			// 成功的时候将备注名返回给上一个界面
			Finish(doctor_level_name);
			break;
		default:
			break;
		}
	}
	
	private void Finish(String doctor_level_name){
		Intent date = new Intent();
		date.putExtra("doctor_level_name", doctor_level_name);
		setResult(1, date);
		finish();
	}

}
